package edu.sctu.nieyu.day20150628exam.deal;

import edu.sctu.nieyu.day20150628exam.data.GoodsData;
import edu.sctu.nieyu.day20150628exam.data.UrlUtil;

import java.io.IOException;

/**
 * Created by user01 on 2015/6/28.
 */
public class ThreadUtil implements Runnable {
    /**
     * 运用线程，休眠五秒后开始程序
     */
    @Override
    public void run() {
        try {
            System.out.println("*******缓冲五秒*********");
            for (int i = 5; i > 0; i--) {
                System.out.println(i);
                Thread.sleep(1000);
            }
            System.out.println("*****程序开始******");
            /**
             * 程序开始
             */
            HttpUtil httpUtil = new HttpUtil();
            httpUtil.setPost(UrlUtil.URL_PATH, httpUtil.hashMapData("1", "50"));
            JsonUtil jsonUtil = new JsonUtil();
            GoodsData goodsData = jsonUtil.jsonMessage("D:/Json/Json.txt");

            jsonUtil.SerializableJson(goodsData,"D:/Json/Appbean.txt");
            GoodsCount.getGoodsCount(jsonUtil.antiSerializableJson("D:/Json/Appbean.txt"));

        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
